<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<%response.setHeader("Pragma","No-cache");
	response.setHeader("Cache-Control","no-cache");
	response.setDateHeader("Expires", 0);
	response.flushBuffer();%>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<%--<link rel="icon" href="https://static.jianshukeji.com/highcharts/images/favicon.ico">--%>
	<meta name="viewport" content="width=device-width, maximum-scale=1.0, user-scalable=no">
	<style type="text/css">
		#container {
			height: 90vh;
			margin: 0 auto;
		}
	</style>
	<script src="http://echarts.baidu.com/build/dist/echarts.js"></script>
	<script type="text/javascript" src="${ctxStatic}/ajz/js/jquery.min.js"></script>
</head>
<body>
<!-- 为ECharts准备一个具备大小（宽高）的Dom -->
<div id="main" style="height:550px"></div>
<!-- ECharts单文件引入 -->
<script>
    $(document).ready(function() {
        var msg = 'person';
        $.ajax({
            url: "/a/ajz/ajzBaseinfo/findCompanyByArea",
            type: "POST",
            data: "msg="+msg,
            dataType: "json",
            async: true,
            success: function (map) {

                var second_grid_pre = parseInt(map.second_grid_pre);
                var first_grid_pre = parseInt(map.first_grid_pre);
                var third_grid_pre= parseInt(map.third_grid_pre);
                var xianglu_pre = parseInt(map.xianglu_pre);
                var xiayang_pre = parseInt(map.xiayang_pre);
                var xinwan_pre = parseInt(map.xinwan_pre);
                var firs_farm_pre = parseInt(map.firs_farm_pre);
                var yanjie_pre = parseInt(map.yanjie_pre);
                var other_pre = parseInt(map.other_pre);
                var xinan_pre = parseInt(map.xinan_pre);
                getDate(xianglu_pre,xiayang_pre,xinwan_pre,xinan_pre,firs_farm_pre);
            }
        });
    });

	function getDate(xianglu_pre,xiayang_pre,xinwan_pre,xinan_pre,firs_farm_pre) {
        // 路径配置
        require.config({
            paths: {
                echarts: 'http://echarts.baidu.com/build/dist'
            }
        });
        // 使用
        require(
            [
                'echarts',
                'echarts/chart/pie' // 使用柱状图就加载bar模块，按需加载
            ],
            function (ec) {
					// 基于准备好的dom，初始化echarts图表
                var myChart = ec.init(document.getElementById('main'));
                option = {
                    title : {
                        text: '店面分布详情',
                        subtext: '新阳安监',
                        x:'center'
                    },
                    tooltip : {
                        trigger: 'item',
                        formatter: "{a} <br/>{b} : {c} ({d}%)"
                    },
                    legend: {
                        orient : 'vertical',
                        x : 'left',
                        data:['新垵村','第一农场','祥露社区','兴旺社区','霞阳社区']
                    },
                    toolbox: {
                        show : true,
                        feature : {
                            mark : {show: true},
                            dataView : {show: true, readOnly: false},
                            magicType : {
                                show: true,
                                type: ['pie', 'funnel'],
                                option: {
                                    funnel: {
                                        x: '25%',
                                        width: '50%',
                                        funnelAlign: 'left',
                                        max: 1548
                                    }
                                }
                            },
                            restore : {show: true},
                            saveAsImage : {show: true}
                        }
                    },
                    calculable : true,
                    series : [
                        {
                            name:'访问来源',
                            type:'pie',
                            radius : '55%',
                            center: ['50%', '60%'],
                            data:[
                                {value:xinan_pre, name:'新垵村'},
                                {value:firs_farm_pre, name:'第一农场'},
                                {value:xianglu_pre, name:'祥露社区'},
                                {value:xinwan_pre, name:'兴旺社区'},
                                {value:xiayang_pre, name:'霞阳社区'}
                            ]
                        }
                    ]
                };

                // 为echarts对象加载数据
                myChart.setOption(option);
            }
        );
    }
</script>
</body>
</html>